What makes one song more popular? What makes one song a “top song”? Could the definitive formula be found for all the songs we want to write to be successful?
This is the object of research that I would like to propose. But I didn’t want to stay just at that point, I’d like to go a little further.
Because in the last celebration of the grammys something caught my attention, they did an interview with a woman music producer and she claimed that only around 3% of the workers in the music industry are women and she wanted to claim this. And although they are currently trying to show that the situation of women has improved in this “world” when you try to investigate a little more you realize that it really is not so.
So I decided that the topic I would investigate would be the most listened to women today.
My research is based on a principle of researching the playlists of the most listened to women in 2016,2017 and 2018. This would serve to determine which style of music could be the most listened to with female singers.
Once analyzed the 3 lists we can say that the most listened to are: Beyoncé’s 7/11 in 2016, Selena Gomez’s Wolves in 2017 and finally in 2018, the most listened to song was Lady Gaga’s Shallow from the movie “a star has born”, although this one is exactly in the same points as Ellie Goulding’s Close To Me, and I chose Shallow because, in my opinion, it made much more impact than this second song.
After having these three songs, I’d like to compare them so that I can see how the most listened to women of the last 3 years have evolved to see if they follow any pattern or if it’s just a coincidence that these are the 3 most listened to.
Keep in mind that the order of all graphics if they are individual will be: 2016, 2017 and 2018. And if they are comparative it will be 2016 vs 2017, 2017 vs 2018 and if there is a third it will be 2016 vs 2018.
Here we can see the pitch graphics of 7/11, Wolves and Shallow respectively. As we can see, the first and second have something in common, but the third already deviates from the other ones.
Here we can observe the comparison of the time warping between the three songs. Clearly the 2017 song and the 2018 song have more in common than the 2016 song with any of the others. Really the information that this section gives us could be easily deductible if we listen to the 3 songs because we can observe that although wolves is an electronic nation does not leave behind a structure similar to shallow by Lady Gaga, however, Beyoncé has nothing to do with it.
Looking now the ceptograms, we can observe that again, the songs of 2017- 2018 have some similarity, but that nevertheless the 2016 returns to break with the norm that they are similar. However, one thing we can see is that they are all within more or less the same range, there is no exaggeration and although Wolves and Shallow are more alike 7/11 is not out of the frame at all.
However, we see that with respect to the structure of this analysis, Shallow looks more like Wolves than 7/11. Thanks to the fact that we already know that Wolves and Shallow have a similar structure, we are not surprised that they are the most similar graphics. Are we perhaps dealing with a possible formula? Because although Beyoncé’s is different these two songs are fulfilling a kind of pattern.
In this case we will not only analyse the most listened to songs of each year, but we will also add the top of songs that Spotify made each year.
The ratio of the tempo between 2016 and 2018 is more equal than in 2017, we see the beginning of the trend. And at the same time the timbre is also much more equal than the previous year. Were we suffering an evolution towards the music of 2018? And contrary to what we would have deduced from the previous data, the music of 2016 is more similar to 2018 than that of 2016, will it be that everything analyzed above is only good for the most famous song of each year and that all the others are more similar to those of 2017?
In this case we will not only analyse the most listened to songs of each year, but we will also add the top of songs that Spotify made each year.
What do the most listened to songs sung by women in 2017 and 2018 have in common? As we can see in 2018 there was a more general tendency to music with a much more developed tempo (btw). And a much higher timbre in general. While 2017 resulted in a year in which the music was “quieter” and with a lower timbre. Thanks to all the previous coincidences we could deduce that this table could be quite similar, nevertheless, the method of deduction does not work in this occasion and although we did not deviate too much, we did not manage to find so much similarity.
Here we can see a list of coincidences that could be found between the 2016, 2017, and 2018 lists.
Here what we can observe is that there is a similarity between 7/11, which represent the first two graphs, and Wolves which are the next two, however the shallow song of 2018 breaks a small pattern that we could have found.
As we have seen, analyzing only the most famous of each year can lead to confusion, so I decided to make a heading with the top 3 of each year, to see if it might be possible to come to some conclusion. Being the top of 2018: Shallow, I like it and Let You Love Me Those of 2017: Hello, I got you and 7/11 respectively and finally those of 2016: Meant to be, *New Rules and Wolves** , presented from the third most listened to to the most. Could we get to some classification?
We have done an analysis tour through the most famous or listened songs of 2016, 2017 and 2018 in which we have tried to decipher a pattern to see if we could get to guess the “formula” of the success of these actions to create the next song that will make a boom. So is there a secret formula to create this super hit sung by a female artist? At some point we might come to believe that yes, however with form we are adding analysis and reviewing more features we can come to the conclusion that not really, there is no such magic formula.
---
title: "woman in music"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
source: embed
---
```{r setup, include=FALSE}
library(tidyverse)
library(shiny)
library(tidymodels)
library(ggdendro)
library(protoclust)
library(plotly)
library(heatmaply)
library(spotifyr)
library(compmus)
```
Woman in music
-----------------------------------------------------------------------
### Presentation
What makes one song more popular? What makes one song a "top song"? Could the definitive formula be found for all the songs we want to write to be successful?
This is the object of research that I would like to propose. But I didn't want to stay just at that point, I'd like to go a little further.
Because in the last celebration of the grammys something caught my attention, they did an interview with a woman music producer and she claimed that only around 3% of the workers in the music industry are women and she wanted to claim this. And although they are currently trying to show that the situation of women has improved in this "world" when you try to investigate a little more you realize that it really is not so.
So I decided that the topic I would investigate would be the most listened to women today.
My research is based on a principle of researching the playlists of the most listened to women in 2016,2017 and 2018. This would serve to determine which style of music could be the most listened to with female singers.
Once analyzed the 3 lists we can say that the most listened to are: **Beyoncé's** *7/11* in 2016, **Selena Gomez**'s *Wolves* in 2017 and finally in 2018, the most listened to song was **Lady Gaga's** *Shallow* from the movie "a star has born", although this one is exactly in the same points as Ellie Goulding's Close To Me, and I chose Shallow because, in my opinion, it made much more impact than this second song.
After having these three songs, I'd like to compare them so that I can see how the most listened to women of the last 3 years have evolved to see if they follow any pattern or if it's just a coincidence that these are the 3 most listened to.
*Keep in mind that the order of all graphics if they are individual will be: 2016, 2017 and 2018. And if they are comparative it will be 2016 vs 2017, 2017 vs 2018 and if there is a third it will be 2016 vs 2018.*
-----------------------------------------------------------------------
### Chromagrams
```{r chromagrams}{.sidebar}
wolves <-
get_tidy_audio_analysis('0tBbt8CrmxbjRP0pueQkyU') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
beyonce <-
get_tidy_audio_analysis('02M6vucOvmRfMxTXDUwRXu') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
shallow <-
get_tidy_audio_analysis('2VxeLyX666F8uXCJ0dZF8B') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
beyonce %>%
mutate(pitches = map(pitches, compmus_normalise, 'euclidean')) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_minimal()
wolves %>%
mutate(pitches = map(pitches, compmus_normalise, 'euclidean')) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_minimal()
shallow %>%
mutate(pitches = map(pitches, compmus_normalise, 'euclidean')) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_minimal()
```
***
Here we can see the pitch graphics of 7/11, Wolves and Shallow respectively. As we can see, the first and second have something in common, but the third already deviates from the other ones.
###Timewarping
```{r}
wolves <-
get_tidy_audio_analysis('0tBbt8CrmxbjRP0pueQkyU') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
beyonce <-
get_tidy_audio_analysis('02M6vucOvmRfMxTXDUwRXu') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
shallow <-
get_tidy_audio_analysis('2VxeLyX666F8uXCJ0dZF8B') %>%
select(segments) %>% unnest(segments) %>%
select(start, duration, pitches)
compmus_long_distance(
wolves %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
beyonce %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
feature = pitches,
method = 'euclidean') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
scale_fill_continuous(type = 'viridis', guide = 'none') +
labs(x = 'Wolves by Selena Gomez', y = '7/11 by Beyoncé') +
theme_minimal()
compmus_long_distance(
shallow %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
wolves %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
feature = pitches,
method = 'euclidean') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
scale_fill_continuous(type = 'viridis', guide = 'none') +
labs(x = 'Shallow by Lady Gaga', y = 'Wolves by Selena Gomez') +
theme_minimal()
compmus_long_distance(
beyonce %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
shallow %>% mutate(pitches = map(pitches, compmus_normalise, 'chebyshev')),
feature = pitches,
method = 'euclidean') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
scale_fill_continuous(type = 'viridis', guide = 'none') +
labs(x = '7/11 by Beyoncé', y = 'Shallow by Lady Gaga') +
theme_minimal()
```
***
Here we can observe the comparison of the time warping between the three songs. Clearly the 2017 song and the 2018 song have more in common than the 2016 song with any of the others. Really the information that this section gives us could be easily deductible if we listen to the 3 songs because we can observe that although **wolves** is an electronic nation does not leave behind a structure similar to **shallow** by *Lady Gaga*, however, Beyoncé has nothing to do with it.
### Cepstrogram
```{r}
wolvees <-
get_tidy_audio_analysis('0tBbt8CrmxbjRP0pueQkyU') %>%
compmus_align(bars, segments) %>%
select(bars) %>% unnest(bars) %>%
mutate(
pitches =
map(segments,
compmus_summarise, pitches,
method = 'rms', norm = 'euclidean')) %>%
mutate(
timbre =
map(segments,
compmus_summarise, timbre,
method = 'mean'))
beyoncee <-
get_tidy_audio_analysis('02M6vucOvmRfMxTXDUwRXu') %>%
compmus_align(bars, segments) %>%
select(bars) %>% unnest(bars) %>%
mutate(
pitches =
map(segments,
compmus_summarise, pitches,
method = 'rms', norm = 'euclidean')) %>%
mutate(
timbre =
map(segments,
compmus_summarise, timbre,
method = 'mean'))
shalloww <-
get_tidy_audio_analysis('2VxeLyX666F8uXCJ0dZF8B') %>%
compmus_align(bars, segments) %>%
select(bars) %>% unnest(bars) %>%
mutate(
pitches =
map(segments,
compmus_summarise, pitches,
method = 'rms', norm = 'euclidean')) %>%
mutate(
timbre =
map(segments,
compmus_summarise, timbre,
method = 'mean'))
beyoncee %>%
compmus_gather_timbre %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = basis,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
scale_fill_viridis_c(option = 'E') +
theme_classic()
wolvees %>%
compmus_gather_timbre %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = basis,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
scale_fill_viridis_c(option = 'E') +
theme_classic()
shalloww %>%
compmus_gather_timbre %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = basis,
fill = value)) +
geom_tile() +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
scale_fill_viridis_c(option = 'E') +
theme_classic()
```
***
Looking now the ceptograms, we can observe that again, the songs of 2017- 2018 have some similarity, but that nevertheless the 2016 returns to break with the norm that they are similar. However, one thing we can see is that they are all within more or less the same range, there is no exaggeration and although Wolves and Shallow are more alike 7/11 is not out of the frame at all.
### comparation
```{r}
beyoncee %>%
compmus_self_similarity(timbre, 'cosine') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
coord_fixed() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
theme_classic() +
labs(x = '', y = '')
wolvees %>%
compmus_self_similarity(timbre, 'cosine') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
coord_fixed() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
theme_classic() +
labs(x = '', y = '')
shalloww %>%
compmus_self_similarity(timbre, 'cosine') %>%
ggplot(
aes(
x = xstart + xduration / 2,
width = xduration,
y = ystart + yduration / 2,
height = yduration,
fill = d)) +
geom_tile() +
coord_fixed() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
theme_classic() +
labs(x = '', y = '')
```
***
However, we see that with respect to the structure of this analysis, Shallow looks more like Wolves than 7/11. Thanks to the fact that we already know that Wolves and Shallow have a similar structure, we are not surprised that they are the most similar graphics. Are we perhaps dealing with a possible formula? Because although Beyoncé's is different these two songs are fulfilling a kind of pattern.
### 2016 vs 2018
```{r}
woman2016 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
woman2017 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX27hx1vGd0BZ') %>%
slice(1:30) %>%
add_audio_analysis()
woman2018 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
womanunoydos <-
woman2016 %>% mutate(genre = "Year 2016") %>%
bind_rows(woman2017 %>% mutate(genre = "Year 2017"))
womandosytres <-
woman2017 %>% mutate(genre = "Year 2017") %>%
bind_rows(woman2018 %>% mutate(genre = "Year 2018"))
womanunoytres <-
woman2017 %>% mutate(genre = "Year 2016") %>%
bind_rows(woman2018 %>% mutate(genre = "Year 2018"))
womanunoytres %>%
mutate(
sections =
map(
sections,
summarise_at,
vars(tempo, loudness, duration),
list(section_mean = mean, section_sd = sd))) %>%
unnest(sections) %>%
ggplot(
aes(
x = tempo,
y = tempo_section_sd,
colour = genre,
alpha = loudness)) +
geom_point(aes(size = duration / 60)) +
geom_rug() +
theme_minimal() +
ylim(0, 5) +
labs(
x = 'Mean Tempo (bpm)',
y = 'SD Tempo',
colour = 'Genre',
size = 'Duration (min)',
alpha = 'Volume (dBFS)')
womanunoytres %>%
mutate(
timbre =
map(
segments,
compmus_summarise,
timbre,
method = 'mean')) %>%
select(genre, timbre) %>%
compmus_gather_timbre %>%
ggplot(aes(x = basis, y = value, fill = genre)) +
geom_violin() +
scale_fill_viridis_d() +
labs(x = 'Spotify Timbre Coefficients', y = '', fill = 'Genre')
```
***
In this case we will not only analyse the most listened to songs of each year, but we will also add the top of songs that Spotify made each year.
The ratio of the tempo between 2016 and 2018 is more equal than in 2017, we see the beginning of the trend. And at the same time the timbre is also much more equal than the previous year. Were we suffering an evolution towards the music of 2018? And contrary to what we would have deduced from the previous data, the music of 2016 is more similar to 2018 than that of 2016, will it be that everything analyzed above is only good for the most famous song of each year and that all the others are more similar to those of 2017?
### 2017 vs 2018
```{r}
woman2016 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
woman2017 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX27hx1vGd0BZ') %>%
slice(1:30) %>%
add_audio_analysis()
woman2018 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
womanunoydos <-
woman2016 %>% mutate(genre = "Year 2016") %>%
bind_rows(woman2017 %>% mutate(genre = "Year 2017"))
womandosytres <-
woman2017 %>% mutate(genre = "Year 2017") %>%
bind_rows(woman2018 %>% mutate(genre = "Year 2018"))
womanunoytres <-
woman2017 %>% mutate(genre = "Year 2016") %>%
bind_rows(woman2018 %>% mutate(genre = "Year 2018"))
womandosytres %>%
mutate(
sections =
map(
sections,
summarise_at,
vars(tempo, loudness, duration),
list(section_mean = mean, section_sd = sd))) %>%
unnest(sections) %>%
ggplot(
aes(
x = tempo,
y = tempo_section_sd,
colour = genre,
alpha = loudness)) +
geom_point(aes(size = duration / 60)) +
geom_rug() +
theme_minimal() +
ylim(0, 5) +
labs(
x = 'Mean Tempo (bpm)',
y = 'SD Tempo',
colour = 'Genre',
size = 'Duration (min)',
alpha = 'Volume (dBFS)')
womandosytres %>%
mutate(
timbre =
map(
segments,
compmus_summarise,
timbre,
method = 'mean')) %>%
select(genre, timbre) %>%
compmus_gather_timbre %>%
ggplot(aes(x = basis, y = value, fill = genre)) +
geom_violin() +
scale_fill_viridis_d() +
labs(x = 'Spotify Timbre Coefficients', y = '', fill = 'Genre')
```
***
In this case we will not only analyse the most listened to songs of each year, but we will also add the top of songs that Spotify made each year.
What do the most listened to songs sung by women in 2017 and 2018 have in common? As we can see in 2018 there was a more general tendency to music with a much more developed tempo (btw). And a much higher timbre in general. While 2017 resulted in a year in which the music was "quieter" and with a lower timbre. Thanks to all the previous coincidences we could deduce that this table could be quite similar, nevertheless, the method of deduction does not work in this occasion and although we did not deviate too much, we did not manage to find so much similarity.
###Prediction vs. Truth
```{r}
woman2016 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
woman2017 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX27hx1vGd0BZ') %>%
slice(1:30) %>%
add_audio_analysis()
woman2018 <-
get_playlist_audio_features(
'spotify',
'37i9dQZF1DX82tVoNhkbcO') %>%
slice(1:30) %>%
add_audio_analysis()
wowoman <-
woman2016 %>% mutate(playlist = "Year 2016") %>%
bind_rows(
woman2017 %>% mutate(playlist = "Year 2017"),
woman2018 %>% mutate(playlist = "Year 2018")) %>%
mutate(playlist = factor(playlist)) %>%
mutate(
segments =
map2(segments, key, compmus_c_transpose)) %>%
mutate(
pitches =
map(segments,
compmus_summarise, pitches,
method = 'mean', norm = 'manhattan'),
timbre =
map(
segments,
compmus_summarise, timbre,
method = 'mean')) %>%
mutate(pitches = map(pitches, compmus_normalise, 'clr')) %>%
mutate_at(vars(pitches, timbre), map, bind_rows) %>%
unnest(pitches, timbre)
wowoman_class <-
recipe(playlist ~
danceability +
energy +
loudness +
speechiness +
acousticness +
instrumentalness +
liveness +
valence +
tempo +
duration_ms +
C + `C#|Db` + D + `D#|Eb` +
E + `F` + `F#|Gb` + G +
`G#|Ab` + A + `A#|Bb` + B +
c01 + c02 + c03 + c04 + c05 + c06 +
c07 + c08 + c09 + c10 + c11 + c12,
data = wowoman) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors()) %>%
# step_range(all_predictors()) %>%
prep(wowoman) %>%
juice
wowoman_cv <- wowoman_class %>% vfold_cv(5)
wowoman_knn <- nearest_neighbor(neighbors = 1) %>% set_engine('kknn')
predict_knn <- function(split)
fit(wowoman_knn, playlist ~ ., data = analysis(split)) %>%
predict(assessment(split), type = 'class') %>%
bind_cols(assessment(split))
wowoman_cv %>%
mutate(pred = map(splits, predict_knn)) %>% unnest(pred) %>%
conf_mat(truth = playlist, estimate = .pred_class) %>%
autoplot(type = 'heatmap')
```
***
Here we can see a list of coincidences that could be found between the 2016, 2017, and 2018 lists.
### Patrons
```{r}
wooolves <-
get_tidy_audio_analysis('0tBbt8CrmxbjRP0pueQkyU') %>%
select(segments) %>% unnest(segments)
shalooow <-
get_tidy_audio_analysis('2VxeLyX666F8uXCJ0dZF8B') %>%
select(segments) %>% unnest(segments)
beyooonce <-
get_tidy_audio_analysis('02M6vucOvmRfMxTXDUwRXu') %>%
select(segments) %>% unnest(segments)
beyooonce %>%
mutate(loudness_max_time = start + loudness_max_time) %>%
arrange(loudness_max_time) %>%
mutate(delta_loudness = loudness_max - lag(loudness_max)) %>%
ggplot(aes(x = loudness_max_time, y = pmax(0, delta_loudness))) +
geom_line() +
xlim(0, 30) +
theme_minimal() +
labs(x = 'Time (s)', y = 'Novelty')
beyooonce %>%
mutate(pitches = map(pitches, compmus_normalise, 'clr')) %>%
arrange(start) %>%
mutate(pitches = map2(pitches, lag(pitches), `-`)) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = pmax(0, value))) +
geom_tile() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
xlim(0, 30) +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_classic()
wooolves %>%
mutate(loudness_max_time = start + loudness_max_time) %>%
arrange(loudness_max_time) %>%
mutate(delta_loudness = loudness_max - lag(loudness_max)) %>%
ggplot(aes(x = loudness_max_time, y = pmax(0, delta_loudness))) +
geom_line() +
xlim(0, 30) +
theme_minimal() +
labs(x = 'Time (s)', y = 'Novelty')
wooolves %>%
mutate(pitches = map(pitches, compmus_normalise, 'clr')) %>%
arrange(start) %>%
mutate(pitches = map2(pitches, lag(pitches), `-`)) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = pmax(0, value))) +
geom_tile() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
xlim(0, 30) +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_classic()
shalooow %>%
mutate(loudness_max_time = start + loudness_max_time) %>%
arrange(loudness_max_time) %>%
mutate(delta_loudness = loudness_max - lag(loudness_max)) %>%
ggplot(aes(x = loudness_max_time, y = pmax(0, delta_loudness))) +
geom_line() +
xlim(0, 30) +
theme_minimal() +
labs(x = 'Time (s)', y = 'Novelty')
shalooow %>%
mutate(pitches = map(pitches, compmus_normalise, 'clr')) %>%
arrange(start) %>%
mutate(pitches = map2(pitches, lag(pitches), `-`)) %>%
compmus_gather_chroma %>%
ggplot(
aes(
x = start + duration / 2,
width = duration,
y = pitch_class,
fill = pmax(0, value))) +
geom_tile() +
scale_fill_viridis_c(option = 'E', guide = 'none') +
xlim(0, 30) +
labs(x = 'Time (s)', y = NULL, fill = 'Magnitude') +
theme_classic()
```
***
Here what we can observe is that there is a similarity between *7/11*, which represent the first two graphs, and *Wolves* which are the next two, however the *shallow* song of 2018 breaks a small pattern that we could have found.
###Dendrogram
```{r}
top3woman <-
get_playlist_audio_features('21lvahlac7sbowf4rk5wedszi','5arkYz4W5msKrKu9mwkg2x') %>%
add_audio_analysis %>%
mutate(
segments =
map2(segments, key, compmus_c_transpose)) %>%
mutate(
segments =
map(
segments,
mutate,
delta_timbre = map2(timbre, lag(timbre), `-`))) %>%
mutate(
pitches =
map(segments,
compmus_summarise, pitches,
method = 'mean', norm = 'manhattan'),
timbre =
map(
segments,
compmus_summarise, timbre,
method = 'mean'),
delta_timbre =
map(
segments,
compmus_summarise, delta_timbre,
method = 'mean')) %>%
mutate(pitches = map(pitches, compmus_normalise, 'clr')) %>%
mutate_at(vars(pitches, timbre, delta_timbre), map, bind_rows) %>%
unnest(pitches, timbre, delta_timbre)
top3woman_juice <-
recipe(track_name ~
danceability +
energy +
loudness +
speechiness +
acousticness +
instrumentalness +
liveness +
valence +
tempo +
duration_ms +
C + `C#|Db` + D + `D#|Eb` +
E + `F` + `F#|Gb` + G +
`G#|Ab` + A + `A#|Bb` + B +
c01 + c02 + c03 + c04 + c05 + c06 +
c07 + c08 + c09 + c10 + c11 + c12,
data = top3woman) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors()) %>%
prep(top3woman %>% mutate(track_name = str_trunc(track_name, 20))) %>%
juice %>%
column_to_rownames('track_name')
woman3_dist <- dist(top3woman_juice, method = 'euclidean')
hclust(woman3_dist, method = 'single') %>% dendro_data %>% ggdendrogram
```
***
As we have seen, analyzing only the most famous of each year can lead to confusion, so I decided to make a heading with the top 3 of each year, to see if it might be possible to come to some conclusion. Being the top of 2018: **Shallow**, **I like it** and **Let You Love Me** Those of 2017: **Hello**, **I got you** and **7/11** respectively and finally those of 2016: **Meant to be**, *New Rules** and **Wolves** , presented from the third most listened to to the most. Could we get to some classification?
### Conclusion
We have done an analysis tour through the most famous or listened songs of 2016, 2017 and 2018 in which we have tried to decipher a pattern to see if we could get to guess the "formula" of the success of these actions to create the next song that will make a boom. So is there a secret formula to create this super hit sung by a female artist? At some point we might come to believe that yes, however with form we are adding analysis and reviewing more features we can come to the conclusion that not really, there is no such magic formula.